home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 September / PCWorld_2008-09_cd.bin / domacnost a kancelar / joomla / Joomla_1.5.4-Stable-Full_Package.exe / includes / pathway.php < prev    next >
PHP Script  |  2008-07-06  |  2KB  |  68 lines

  1. <?php
  2. /**
  3. * @version        $Id: pathway.php 8180 2007-07-23 05:52:29Z eddieajau $
  4. * @package        Joomla.Framework
  5. * @subpackage    Application
  6. * @copyright    Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
  7. * @license        GNU/GPL, see LICENSE.php
  8. * Joomla! is free software. This version may have been modified pursuant
  9. * to the GNU General Public License, and as distributed it includes or
  10. * is derivative of works licensed under the GNU General Public License or
  11. * other free or open source software licenses.
  12. * See COPYRIGHT.php for copyright notices and details.
  13. */
  14.  
  15. // Check to ensure this file is within the rest of the framework
  16. defined('JPATH_BASE') or die();
  17.  
  18. /**
  19.  * Class to manage the site application pathway
  20.  *
  21.  * @author        Johan Janssens <johan.janssens@joomla.org>
  22.  * @package     Joomla
  23.  * @since        1.5
  24.  */
  25. class JPathwaySite extends JPathway
  26. {
  27.     /**
  28.      * Class constructor
  29.      */
  30.     function __construct($options = array())
  31.     {
  32.         //Initialise the array
  33.         $this->_pathway = array();
  34.  
  35.         $menu   =& JSite::getMenu();
  36.  
  37.         if($item = $menu->getActive())
  38.         {
  39.             $menus    = $menu->getMenu();
  40.             $home    = $menu->getDefault();
  41.  
  42.             if(is_object($home) && ($item->id != $home->id))
  43.             {
  44.                 foreach($item->tree as $menupath)
  45.                 {
  46.                     $url  = '';
  47.                     $link = $menu->getItem($menupath);
  48.  
  49.                     switch($link->type)
  50.                     {
  51.                         case 'menulink' :
  52.                         case 'url' :
  53.                             $url = $link->link;
  54.                             break;
  55.                         case 'separator' :
  56.                             $url = null;
  57.                             break;
  58.                         default      :
  59.                             $url = 'index.php?Itemid='.$link->id;
  60.                     }
  61.  
  62.                     $this->addItem( $menus[$menupath]->name, $url);
  63.  
  64.                 } // end foreach
  65.             }
  66.         } // end if getActive
  67.     }
  68. }